<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <!--[if IE]>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <![endif]-->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Page title -->
    <title>Petz - Pet HTML5 Template</title>
    <!--[if lt IE 9]>
    <script src="${pageContext.request.contextPath}/foreground/js/respond.js"></script>
    <![endif]-->
    <!-- Bootstrap Core CSS -->
    <link href="${pageContext.request.contextPath}/foreground/css/bootstrap.css" rel="stylesheet" type="text/css">
    <!-- Icon fonts -->
    <link href="${pageContext.request.contextPath}/foreground/fonts/font-awesome/css/font-awesome.min.css"
          rel="stylesheet" type="text/css">
    <link href="${pageContext.request.contextPath}/foreground/fonts/flaticons/flaticon.css" rel="stylesheet"
          type="text/css">
    <link href="${pageContext.request.contextPath}/foreground/fonts/glyphicons/bootstrap-glyphicons.css"
          rel="stylesheet" type="text/css">
    <!-- Google fonts -->
    <link href="https://fonts.googleapis.com/css?family=Lato:400,800" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Baloo+Thambi" rel="stylesheet">
    <!-- Style CSS -->
    <link href="${pageContext.request.contextPath}/foreground/css/style.css" rel="stylesheet">
    <!-- Plugins CSS -->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/foreground/css/plugins.css">
    <!-- Color Style CSS -->
    <link href="${pageContext.request.contextPath}/foreground/styles/maincolors.css" rel="stylesheet">

    <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
    <script type="text/javascript">
        function findTypeAnimal(data) {
            $.ajax({
                type: "get",
                url: "findAnimalByTypeId",
                data: {
                    type_id: data.toString()
                },
                success: function () {
                    $("#bbb").load("http://localhost:8080/HelpAnimal/allAnimalType #bbb");
                }
            })

        }

        function findAllAnimal() {
            $.ajax({
                type: "get",
                url: "findAllAnimal",
                success: function () {
                    $("#bbb").load("http://localhost:8080/HelpAnimal/allAnimalType #bbb");
                }
            })

        }


    </script>

</head>
<body>
    <!-- 最上面的橙色导航栏模块-->
    <nav class="navbar navbar-custom navbar-fixed-top">
        <div class="container">
            <!-- 顶部导航栏中间的商标 -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-brand-centered">
                    <i class="fa fa-bars"></i>
                </button>
                <div class="navbar-brand navbar-brand-centered page-scroll">
                    <a href="#page-top">
                        <img src="${pageContext.request.contextPath}/foreground/img/logo1.png" class="img-responsive"
                             alt="">
                    </a>
                </div>
            </div>

            <div class="collapse navbar-collapse" id="navbar-brand-centered">
                <!-- 顶部导航栏商标左边的三个按钮 -->
                <ul class="nav navbar-nav">
                    <li><a href="index.jsp">主页</a></li>
                    <li class="active"><a href="adopt">领养</a></li>

                    <li><a href="help">求助</a></li>
                </ul>
                <!-- 顶部导航栏商标右边的三个按钮 -->
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="offer">捐助</a></li>
                    <li><a href="announcement">公告</a></li>
                    <li><a href="login">管理员登录</a></li>
                </ul>
            </div>
        </div>
    </nav>

    <section id="adoption" class="pages">
        <!-- 最中间的那个蓝色椭圆标题 -->
        <div class="jumbotron" data-stellar-background-ratio="0.5">
            <div class="jumbo-heading" data-stellar-background-ratio="1.2">
                <h1>领养</h1>
            </div>
        </div>

        <div class="container">
            <div class="row margin1">
                <!-- 三个按钮 -->

                <div class="text-center col-md-12 margin1">
                    <ul class="nav nav-pills category text-center">
                        <li onclick="findAllAnimal()"><a>全部</a>
                            <c:forEach items="${allAnimalType}" var="animalType">
                        <li onclick="findTypeAnimal(${animalType.tyId})"><a>${animalType.tyName}</a></li>
                        </c:forEach>
                    </ul>
                </div>

                <!-- 多个圆型图案 -->
                <div class="col-md-12 margin1">
                    <div id="bbb">
                        <c:forEach var="animal" items="${animals}">
                            <div class="col-lg-4 col-sm-6 col-md-6 dog">
                                <div class="isotope-item">
                                    <div class="adoption-thumb">
                                        <img class="img-responsive img-circle" src="${animal.anPicture}" alt="">
                                        <div class="adopt-header">
                                            <h4>${animal.anName}</h4>
                                            <p>${animal.anFormation}</p>
                                            <a class="btn" href="findAnimalById?id=${animal.anId}">领养</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </c:forEach>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <%--<!-- js部分 -->--%>
    <%--<script src="${pageContext.request.contextPath}/webpage/js/jquery.min.js"></script>--%>
    <%--<script src="${pageContext.request.contextPath}/webpage/js/bootstrap.min.js"></script>--%>
    <%--<!-- Main Js -->--%>
    <%--<script src="${pageContext.request.contextPath}/webpage/js/main.js"></script>--%>
    <%--<!--Other Plugins -->--%>
    <%--<script src="${pageContext.request.contextPath}/webpage/js/plugins.js"></script>--%>
    <%--<!-- Prefix free CSS -->--%>
    <%--<script src="${pageContext.request.contextPath}/webpage/js/prefixfree.js"></script>--%>
</body>
</html>
